#include <stdio.h>
#include <math.h>
int main()
{
	int year,month,d,total;
	scanf("%d/%d/%d",&year,&month,&d);
	switch(month){
		case 1:total = d;break;
		case 2:total = 31+d;break;
		case 3:total = 31+28+d;break;
		case 4:total = 31+28+31+d;break;
		case 5:total = 31+28+31+30+d;break;
		case 6:total = 31+28+31+30+31+d;break;
		case 7:total = 31+28+31+30+31+30+d;break;
		case 8:total = 31+28+31+30+31+30+d+31;break;
		case 9:total = 31+28+31+30+31+30+d+31+31;break;
		case 10:total = 31+28+31+30+31+30+d+31+31+30;break;
		case 11:total = 31+28+31+30+31+30+d+31+31+30+31;break;
		case 12:total = 31+28+31+30+31+30+d+31+31+30+31+30;break;
	}if((year%4==0&&year%100!=0||year%400==0)&&month>2){
		total++;
	}printf("%d",total);
	return 0;
}

                         
